home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / xmsif.exe / XMSIF.DOC < prev    next >
Text File  |  1992-11-14  |  44KB  |  971 lines

  1.                                  XMSIF
  2.                       C Interface to XMS Functions
  3.                            XMSIF version 1.42
  4.                           by James W. Birdsall
  5.                                 11/14/92
  6.  
  7.  
  8. 0. CONTENTS
  9. -----------
  10.  
  11.    0.     CONTENTS
  12.    I.     INTRODUCTION
  13.     I.1    WHAT IS SUPPORTED
  14.     I.2    COPYRIGHT, LICENSE, AND WARRANTY DISCLAIMER
  15.    II.    COMPILING AND LINKING WITH THE LIBRARIES
  16.     II.1   WITH C
  17.     II.2   WITH C++
  18.     II.3   XMSTEST, THE EXAMPLE PROGRAM
  19.    III.   PROGRAMMING WITH XMSIF
  20.     III.1  INITIALIZING THE LIBRARY
  21.     III.2  ORDINARY USE
  22.     III.3  TIPS ON USING EMBS
  23.     III.4  TIPS ON USING UMBS
  24.     III.5  OTHER TIPS
  25.     III.6  FUNCTION GROUPINGS
  26.    IV.    LIBRARY REFERENCE
  27.     IV.1   GLOBAL VARIABLES
  28.     IV.2   EMB FUNCTIONS
  29.     IV.3   UMB FUNCTIONS
  30.    V.     ERROR CODES
  31.     V.1    INTERNAL ERRORS
  32.     V.2    XMS DRIVER ERRORS
  33.    VI.    THE END
  34.     VI.1   ACKNOWLEDGEMENTS
  35.  
  36.  
  37. I. INTRODUCTION
  38. ---------------
  39.  
  40.    XMSIF provides a high-level interface to XMS control functions for
  41. common operations such as allocating and freeing XMS extended memory
  42. blocks (EMBs) and upper memory blocks (UMBs), and copying data to and
  43. from EMBs. A raw interface to the driver has been included to allow more
  44. convenient access to driver functions not otherwise supported.
  45.  
  46.    XMSIF is written in assembly language for speed and assembled with
  47. Borland's Turbo Assembler (TASM) 2.5. The source code is not compatible
  48. with the Microsoft Assembler (MASM).
  49.  
  50.  I.1 WHAT IS SUPPORTED
  51.  ---------------------
  52.  
  53.    XMSIF expressly supports the Microsoft eXtended Memory Specification
  54. (XMS) version 2.0. Versions below 2.0 are not supported. Versions above
  55. 2.0 are supported as 2.0.
  56.  
  57.    XMSIF supports tiny, small, medium, compact, large, and huge memory
  58. models. The small model library supports both tiny and small models, so
  59. no library is provided specifically for tiny model.
  60.  
  61.    XMSIF supports any version of Turbo C, Turbo C++, or Borland C++, in
  62. both C and C++ modes, and Microsoft C 6.00/A and C/C++ 7.0. XMSIF has
  63. been tested with Borland C++ 2.0, Turbo C 2.0, Microsoft C 6.00A, and
  64. Microsoft C/C++ 7.0 in all of the supported memory models. XMSIF should
  65. work with earlier versions of Microsoft C and any other MS-DOS C
  66. compiler that 1) uses compatible parameter passing and return methods
  67. and 2) can use standard-format libraries.
  68.  
  69.  I.2 COPYRIGHT, LICENSE, AND WARRANTY DISCLAIMER
  70.  -----------------------------------------------
  71.  
  72.    XMSIF is not in the public domain. All the files are copyright 1991,
  73. 1992 by James W. Birdsall, all rights reserved. Permission is granted to
  74. do the following:
  75.  
  76.         You may freely redistribute this archive, so long as it contains
  77.         all the files listed in the file MANIFEST, intact and
  78.         unmodified.
  79.  
  80.         You may use the libraries in programs for your own use. You may
  81.         not distribute programs linked with these libraries.
  82.  
  83.    Payment of the $5 shareware registration fee ($50 for commercial use)
  84. grants the following license, in addition to the permissions listed
  85. above:
  86.  
  87.         You may request the source to XMSIF. You may modify the source
  88.         as necessary for use in your programs. However, you may not
  89.         redistribute either the original or modified source. There is no
  90.         additional charge for source.
  91.  
  92.         You may distribute programs linked with either the original
  93.         libraries or libraries generated from source you have modified,
  94.         without royalty, provided you (a) do not alter or remove
  95.         copyright notices contained therein and (b) you indemnify, hold
  96.         harmless, and defend the author from and against any claims or
  97.         lawsuits, including attorney's fees, that arise or result from
  98.         the use or distribution of your software product. 
  99.  
  100. For the purposes of this license, commercial use is defined as use by an
  101. incorporated entity in a software product that is regarded as the
  102. product of the corporation, no matter how the software product is
  103. distributed, but only if 100 or more copies of the product are expected
  104. to be made.
  105.  
  106.    Registered users will also receive update notices and bug reports,
  107. and are entitled to use future versions without further payment.
  108.  
  109.    The contents of the distribution archive, and all other related
  110. files, information, and services are provided "as is" and without
  111. warranty. To the extent permitted by applicable law, the author
  112. disclaims all warranties, express or implied, including but not limited
  113. to, any implied warranty of merchantability or fitness for a particular
  114. purpose. While effort has been made to ensure that the files, information,
  115. and services are accurate and correct, the author shall not be liable
  116. for damages arising out of the use of or inability to use this product,
  117. including but not limited to, loss of profit, data, or use of this
  118. software, or special, incidental, or consequential damages or other
  119. similar claims, even if the author has been specifically advised of the
  120. possibility of such damages. Some states do not allow the exclusion of
  121. incidental or consequential damages, so the foregoing limitation may not
  122. apply to you.
  123.  
  124.    Information on contacting the author is provided at the end of this
  125. file.
  126.  
  127.  
  128. II. COMPILING AND LINKING WITH THE LIBRARIES
  129. --------------------------------------------
  130.  
  131.    This section describes how to use the XMSIF libraries with your
  132. programs.
  133.  
  134.    XMSIF is provided as Borland/Microsoft standard library files.
  135. Libraries are provided for small, medium, compact, large, and huge
  136. memory models (tiny model uses the small model library). The model for
  137. which a library is intended is indicated by the last letter of the
  138. filename proper, which is the same as the first letter for the model.
  139. For example, XMSIFL.LIB is the large model library.
  140.  
  141.  II.1 WITH C
  142.  -----------
  143.  
  144.    To use XMSIF in C programs, you must #include the file XMSIF.H in
  145. every source file that calls XMSIF functions, accesses XMSIF global
  146. variables, or uses #defined constants provided by XMSIF.
  147.  
  148.    The procedures for linking XMSIF with the rest of your program vary
  149. according to the compiler and method you are using. In general, you must
  150. include the appropriate library (the library corresponding to the memory
  151. model in which you have compiled the rest of your program) in the link.
  152.  
  153.    If you are compiling in the Integrated Development Environment of
  154. Turbo/Borland C[++], you should include the name of the appropriate
  155. library in the project file for your program. For example, if you are
  156. working in the compact memory model, you should include XMSIFC.LIB in
  157. your project file.
  158.  
  159.    If you are using a command-line compiler (bcc, tcc, or cl) to compile
  160. and link, simply place the full name of the appropriate XMSIF library on
  161. the command line. For example, "bcc -mc foo.c xmsifc.lib" will compile
  162. the file "foo.c" in the compact model and link it with xmsifc.lib.
  163.  
  164.    If you are linking manually (using TLINK or LINK), place the name of
  165. the appropriate library in with the other libraries. For example,
  166.         tlink c0c.obj foo.obj, foo.exe, foo.map, cc.lib xmsifc.lib
  167. or
  168.         link foo.obj, foo.exe, foo.map, xmsifc.lib ;
  169. will link the object "foo.obj" with the appropriate startup object and
  170. standard library (LINK automatically includes the startup object and
  171. standard library, so it is not necessary to explicitly include them) and
  172. the compact model XMSIF library.
  173.  
  174.  II.2 C++
  175.  --------
  176.  
  177.    To use XMSIF in C++ programs, you must #include the file XMSIF.HPP in
  178. every file that calls XMSIF functions, accesses XMSIF global variables,
  179. or uses #defined constants provided by XMSIF. Be careful to include
  180. XMSIF.HPP instead of XMSIF.H. If you include the wrong one, you will
  181. probably see "undefined symbol" errors when linking.
  182.  
  183.    Otherwise, the procedures for using XMSIF with C++ programs are the
  184. same as for using it with C programs.
  185.  
  186.  II.3 XMSTEST, THE EXAMPLE PROGRAM
  187.  ---------------------------------
  188.  
  189.    A large and complete example program and tester, XMSTEST, h